#ifndef APLB_LOG_H
#define APLB_LOG_H

enum {
	EMRG = 0,
	ALRT,
	CRIT,
	ERR,
	WARN,
	NOTI,
	INFO,
	DEBUG
};

class log {
private:
	int log_file;
	int log_maxsize;
	int log_period;
	int rotate_num;
	char log_path[256];
	pthread_mutex_t lock;
public:
	log();
	void openlog(const char * file);
	void logging(int level, const char * fmt, ...);
	static void logrotate(const char * logfile, int num = 3);
};

#define LOG log.logging

#endif

